const path = require('path');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
    entry: "./app/main",
    output: {
        path: path.resolve(__dirname, "www/dist"),
        filename: "bundle.js"
    },
    module: {
        rules: [
            {
                test: /\.jsx?$/,
                include: [
                    path.resolve(__dirname, "app")
                ],
                exclude: [
                    path.resolve(__dirname, "node_modules")
                ],
                loader: "babel-loader",
                options: {
                    presets: ["env" , "react"] ,
                    plugins: ["transform-object-rest-spread","transform-runtime"]
                }
            },
            {
                test: /\.(le|c)ss$/,
                include: [
                    path.resolve(__dirname, "app/style")
                ],
                exclude: [
                    path.resolve(__dirname, "node_modules")
                ],
                use: ExtractTextPlugin.extract({
                    fallback: "style-loader",
                    use: ["css-loader","less-loader"]
                  })
            },
            {
                test:/.(jpg|png|jpeg)$/,
                use:['url-loader']
            }
        ]
    },
    plugins: [
        new ExtractTextPlugin("styles.css"),
      ],
    watch : true,
    // mode : 'development'
    mode:"production"
}